import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;

// 162
public class P42 {
	private static List<Integer> list = new ArrayList<Integer>();
	
	public static void main(String[] args) throws Exception {
		BufferedReader reader = new BufferedReader(new FileReader(new File("words.txt")));
		String line = reader.readLine().replaceAll("\"", "");
		
		String[] wordArray = line.split(",");
		int count = 0;
		
		for (int i = 0; i < wordArray.length; i++) {
			System.out.println("[" + i + "] " + wordArray[i]);
			byte[] wordByte = wordArray[i].getBytes();
		
			int sum = 0;
			
			for (int j = 0; j < wordByte.length; j++) {
				sum += wordByte[j] - 64;
			}			
			
			while (true) {
				int n = list.size();
				if (n == 0) {
					n = 1;
					list.add((n * (n + 1))/2);
				} else {
					n = n + 1;
				}
				
				
				if (list.contains(new Integer(sum))) {		
					System.out.println(wordArray[i] + ":" + sum);
					count++;
					break;
				} else {				
					int x = list.get(list.size() - 1);
					if (x < sum) {					
						list.add(((n) * (n + 1))/2);
					} else {
						break;
					}
				}
			}	
			
		}
		
		System.out.println();
		System.out.println(count);
		System.out.println();
		for (Integer i : list) {
			System.out.println(i);
		}
	}
}